package com.hunan.api.catv.entity.enums;

import org.springframework.util.ObjectUtils;

/**
 * 验证码类型
 */
public enum SmsTypeEnum {

    LOGIN(1, "login"),

    REGISTER(2, "register"),

    BOUND(3, "bound"),

    CPS(4, "cps"),

    INVIT(5, "invitation");

    private final Integer code;

    private final String msg;


    SmsTypeEnum(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Integer getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    public static String getResult(Integer code) {
        SmsTypeEnum[] rcs = SmsTypeEnum.values();
        for (SmsTypeEnum rc : rcs) {
            if (!ObjectUtils.isEmpty(code) && rc.getCode().equals(code)) {
                return rc.getMsg();
            }
        }
        return null;
    }
}
